# -*- mode: python; -*-

Import("env")

env = env.Clone()

env.SConscript(
    must_exist=1,
    dirs=[
        "compass",
        "msi",
    ],
    exports=[
        "env",
    ],
)

if env.TargetOSIs("windows"):
    # This ensures that the VC++ redistributable is always included in the
    # community server ZIP.

    redist_file = env["MSVS"].get("VCREDISTEXE", None)
    if not redist_file:
        env.FatalError("Required CRT redistributable not found; cannot build distribution package")

    env.AutoInstall(
        target="$PREFIX_BINDIR",
        source=[
            "${MSVS['VCREDISTEXE']}",
        ],
        AIB_COMPONENT="dist",
        AIB_ROLE="runtime",
    )
